package com.top.ruizhong.main.goods

import android.app.Activity
import android.content.Intent
import com.module.lemlin.base.BaseAbstractActivity
import com.top.ruizhong.R
import com.top.ruizhong.main.order.OrderFillActivity
import com.top.ruizhong.popup.GoodsSpecsPopup
import kotlinx.android.synthetic.main.activity_goods_details.*

class GoodsDetailsActivity : BaseAbstractActivity() {

    companion object {
        fun open(activity: Activity) {
            val intent = Intent(activity, GoodsDetailsActivity::class.java)
            activity.startActivity(intent)
        }
    }


    private val goodsSpecsPopup: GoodsSpecsPopup by lazy {
        GoodsSpecsPopup(context = this, onConfirm = {
            OrderFillActivity.open(activity = this)
        })
    }

    override val layoutResId: Int
        get() = R.layout.activity_goods_details

    override fun stateBar(): StatusBar {
        return StatusBar(view = frameGoodsDetailsBar)
    }

    override fun initView() {

        ivGoodsDetailsBack.setOnClickListener {
            this.finish()
        }

        tvGoodsDetailsBuy.setOnClickListener {
            goodsSpecsPopup.showPopupWindow()
            goodsSpecsPopup.showAnimation
        }
    }
}